package com.hujf.flink.DataStreamAPI;


import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Author hujf
 * @Date 2022/3/17 14:43
 * @Description TODO
 */
public class Learn {
    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment executionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStream<String > text = executionEnvironment.readTextFile("./file/word.txt");
        // 数据转换
        DataStream<Integer> map = text.map((MapFunction<String, Integer>) value -> {
            int i = Integer.parseInt(value);
            return i;
        });

        map.print();

        executionEnvironment.execute();

    }
}
